<?php

/**
 * User gateway
 *
 * @author    Mon Zafra <monzee at gmail>
 * @copyright (c)2009 Mon Zafra
 * @license   http://monzee.wordpress.com/license New BSD
 * @version   $Id: User.php 38 2009-02-18 17:12:39Z monzee $
 */
class Admin_Zdt_User extends Admin_Gateway_Zdt
{
    protected $_name = 'users';
    protected $_rowClass = 'Admin_UserValue';
    protected $_rowsetClass = 'Admin_UserSet';

    public function getUserBy($column, $value = null)
    {
        $select = $this->fetchBy($column, $value);

        return $this->fetchRow($select);
    }

    public function getUsersBy($column, $value = null)
    {
        $select = $this->fetchBy($column, $value);

        return $this->fetchAll($select);
    }

    /**
     * Returns the user with the specified username
     *
     * @param string $username
     * @return array
     */
    public function getByUsername($username)
    {
        return $this->getUserBy('username', $username)->toArray();
    }
}
